package vsm.vsm_server.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import vsm.vsm_server.pojo.Tag;

import java.math.BigInteger;

@Mapper
public interface TagMapper {


    @Select("select * from tag where tagId = #{tagId}")
    String getTagContent(BigInteger tagId);


    @Insert("INSERT INTO tag (content) VALUES (#{content})")
    @Options(useGeneratedKeys = true,keyProperty = "tagId",keyColumn = "tagId")
    void saveTag(Tag tag);

    @Select("select tagId from tag where content = #{content}")
    BigInteger existTag(String content);
}
